package com.atguigu.srb.sms.config;

import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class Swagger2Config {

    @Bean
    public Docket adminDocket(){
        Docket admin = new Docket(DocumentationType.SWAGGER_2)
                .groupName("sms")
                .apiInfo(getApiInfo())
                .select()
                .paths(PathSelectors.regex("/api/.*"))
                .build();
        return admin;
    }


    private ApiInfo getApiInfo() {
        ApiInfo apiInfo = new ApiInfoBuilder()
                .title("尚融宝短信接口")
                .description("尚融宝短信端接口")
                .version("1.0")
                .contact(new Contact("bilal", "http://atguigu.com", "2226488966@qq.com")).build();
        return apiInfo;
    }


}
